package com.byedu.model.constants;

/**
 * Created by jason on 2017/6/4.
 */
public enum FileType {
    ZIP(0, "zip"),
    RAR(1, "rar"),
    XLS(2, "xls"),
    XLSX(3, "xlsx"),
    TXT(4, "txt"),
    CSV(5, "csv");

    private Integer key;
    private String value;

    private FileType(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getValue(Integer key) {
        for (FileType fileType : FileType.values()) {
            if (fileType.getKey() == key) {
                return fileType.getValue();
            }
        }

        return null;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.key + "_" + this.value;
    }

}
